using System.Collections;
using System.Collections.Generic;

namespace Commons.Loading
{
	public delegate void TaskCompletedCallback();
	public interface ILoadingTask
	{
		string Name { get; }
		bool IsAsync { get; }
		float Weight { get; }
		
		void Start();

		/* SetUp is called before any Start() */
		void SetUp();
		
		/* TearDown is called after any Update() */
		void TearDown();
		
		/* Update is called to perform actual work */
		IEnumerator Update();
		
		/* Add required id s before execute task */
		ILoadingTask Requires(params string[] requires);
		
		/*Add a callback to call after complete the task*/
		ILoadingTask OnComplete(TaskCompletedCallback callback);
		
		/* Get task progress [0;1] */
		float Progress { get; }
		
		/* Tells whether the task is completed or not (no more work has to be done) */
		bool Completed { get; set;}
		
		/* Tells if the task has started working */
		bool Started { get; }
		bool Halted { get; }
		bool Unlocked { get; }
		
	}
}